import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const FirePredictionMeta: IPublicTypeComponentMetadata = {
  componentName: 'FirePrediction',
  title: '消防预测',
  category: '信息展示',
  group: '消防安全',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'FirePrediction',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '容器宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '容器高度'
    },
    {
      name: 'backgroundColor',
      propType: 'string',
      description: '容器背景色'
    },
    {
      name: 'borderRadius',
      propType: 'number',
      description: '容器圆角'
    },
    {
      name: 'iconPath',
      propType: 'string',
      description: '图标路径'
    },
    {
      name: 'iconSize',
      propType: 'number',
      description: '图标大小'
    },
    {
      name: 'title',
      propType: 'string',
      description: '标题'
    },
    {
      name: 'titleFontSize',
      propType: 'number',
      description: '标题字体大小'
    },
    {
      name: 'titleColor',
      propType: 'string',
      description: '标题颜色'
    },
    {
      name: 'titleFontFamily',
      propType: 'string',
      description: '标题字体'
    },
    {
      name: 'titleFontWeight',
      propType: 'number',
      description: '标题字体粗细'
    },
    {
      name: 'titleLineHeight',
      propType: 'number',
      description: '标题行高'
    },
    {
      name: 'showIndicator',
      propType: 'bool',
      description: '显示指示器'
    },
    {
      name: 'indicatorSize',
      propType: 'number',
      description: '指示器大小'
    },
    {
      name: 'indicatorColor',
      propType: 'string',
      description: '指示器颜色'
    },
    {
      name: 'indicatorOpacity',
      propType: 'number',
      description: '指示器透明度'
    },
    {
      name: 'value',
      propType: 'string',
      description: '数值'
    },
    {
      name: 'valueFontSize',
      propType: 'number',
      description: '数值字体大小'
    },
    {
      name: 'valueColor',
      propType: 'string',
      description: '数值颜色'
    },
    {
      name: 'valueFontFamily',
      propType: 'string',
      description: '数值字体'
    },
    {
      name: 'valueFontWeight',
      propType: 'number',
      description: '数值字体粗细'
    },
    {
      name: 'valueLineHeight',
      propType: 'number',
      description: '数值行高'
    },
    {
      name: 'valueLetterSpacing',
      propType: 'number',
      description: '数值字间距'
    },
    {
      name: 'valueBackground',
      propType: 'string',
      description: '数值背景'
    },
    {
      name: 'showValueBackground',
      propType: 'bool',
      description: '显示数值背景'
    },
    {
      name: 'valueBackgroundWidth',
      propType: 'number',
      description: '数值背景宽度'
    },
    {
      name: 'valueBackgroundHeight',
      propType: 'number',
      description: '数值背景高度'
    },
    {
      name: 'valueBackgroundGradientStart',
      propType: 'string',
      description: '数值背景渐变起始色'
    },
    {
      name: 'valueBackgroundGradientEnd',
      propType: 'string',
      description: '数值背景渐变结束色'
    },
    {
      name: 'valueBackgroundOpacity',
      propType: 'number',
      description: '数值背景透明度'
    },
    {
      name: 'layout',
      propType: 'string',
      description: '布局方式'
    },
    {
      name: 'spacing',
      propType: 'number',
      description: '间距'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      // 容器配置
      {
        name: 'container',
        type: 'group',
        display: 'accordion',
        title: {
          label: '容器配置',
        },
        items: [
          {
            name: 'width',
            title: { label: '容器宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 200 }
          },
          {
            name: 'height',
            title: { label: '容器高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 80 }
          },
          {
            name: 'backgroundColor',
            title: { label: '容器背景色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'transparent' }
          },
          {
            name: 'borderRadius',
            title: { label: '容器圆角' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0 }
          }
        ]
      },
      // 图标配置
      {
        name: 'icon',
        type: 'group',
        display: 'accordion',
        title: {
          label: '图标配置',
        },
        items: [
          {
            name: 'iconPath',
            title: { label: '图标路径' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/xiaofanganquan/01.png' }
          },
          {
            name: 'iconSize',
            title: { label: '图标大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 60 }
          }
        ]
      },
      // 标题配置
      {
        name: 'title',
        type: 'group',
        display: 'accordion',
        title: {
          label: '标题配置',
        },
        items: [
          {
            name: 'title',
            title: { label: '标题' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: '易燃指数' }
          },
          {
            name: 'titleFontSize',
            title: { label: '标题字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
          },
          {
            name: 'titleColor',
            title: { label: '标题颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
          },
          {
            name: 'titleFontFamily',
            title: { label: '标题字体' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'SourceHanSansSC' }
          },
          {
            name: 'titleFontWeight',
            title: { label: '标题字体粗细' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 400 }
          },
          {
            name: 'titleLineHeight',
            title: { label: '标题行高' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 22 }
          }
        ]
      },
      // 指示器配置
      {
        name: 'indicator',
        type: 'group',
        display: 'accordion',
        title: {
          label: '指示器配置',
        },
        items: [
          {
            name: 'showIndicator',
            title: { label: '显示指示器' },
            setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
          },
          {
            name: 'indicatorSize',
            title: { label: '指示器大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 17 }
          },
          {
            name: 'indicatorColor',
            title: { label: '指示器颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
          },
          {
            name: 'indicatorOpacity',
            title: { label: '指示器透明度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.6 }
          }
        ]
      },
      // 数值配置
      {
        name: 'value',
        type: 'group',
        display: 'accordion',
        title: {
          label: '数值配置',
        },
        items: [
          {
            name: 'value',
            title: { label: '数值' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: '0.70' }
          },
          {
            name: 'valueFontSize',
            title: { label: '数值字体大小' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 24 }
          },
          {
            name: 'valueColor',
            title: { label: '数值颜色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#1AD7FF' }
          },
          {
            name: 'valueFontFamily',
            title: { label: '数值字体' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'DINAlternate' }
          },
          {
            name: 'valueFontWeight',
            title: { label: '数值字体粗细' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 700 }
          },
          {
            name: 'valueLineHeight',
            title: { label: '数值行高' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 30 }
          },
          {
            name: 'valueLetterSpacing',
            title: { label: '数值字间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.86 }
          },
          {
            name: 'valueBackground',
            title: { label: '数值背景' },
            setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'linear-gradient(90deg, #FFFFFF 0%, #81C6FF 100%)' }
          }
        ]
      },
      // 数值背景配置
      {
        name: 'valueBackground',
        type: 'group',
        display: 'accordion',
        title: {
          label: '数值背景配置',
        },
        items: [
          {
            name: 'showValueBackground',
            title: { label: '显示数值背景' },
            setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
          },
          {
            name: 'valueBackgroundWidth',
            title: { label: '数值背景宽度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 80 }
          },
          {
            name: 'valueBackgroundHeight',
            title: { label: '数值背景高度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 30 }
          },
          {
            name: 'valueBackgroundGradientStart',
            title: { label: '数值背景渐变起始色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(52,165,255,0)' }
          },
          {
            name: 'valueBackgroundGradientEnd',
            title: { label: '数值背景渐变结束色' },
            setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(0,139,255,0)' }
          },
          {
            name: 'valueBackgroundOpacity',
            title: { label: '数值背景透明度' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 0.65 }
          }
        ]
      },
      // 布局配置
      {
        name: 'layout',
        type: 'group',
        display: 'accordion',
        title: {
          label: '布局配置',
        },
        items: [
          {
            name: 'layout',
            title: { label: '布局方式' },
            setter: {
              componentName: 'RadioGroupSetter',
              isRequired: false,
              initialValue: 'horizontal',
              props: {
                options: [
                  { label: '水平', value: 'horizontal' },
                  { label: '垂直', value: 'vertical' }
                ]
              }
            }
          },
          {
            name: 'spacing',
            title: { label: '间距' },
            setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
          }
        ]
      }
    ],
    supports: {
      style: true,
      className: true,
      events: ['onClick']
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '消防预测',
    screenshot: '',
    schema: {
      componentName: 'FirePrediction',
      props: {
        width: 500,
        height: 102,
        backgroundColor: 'grey',
        borderRadius: 0,
        iconPath: 'http://localhost:8085/static/images/xiaofanganquan/01.png',
        iconSize: 60,
        title: '易燃指数',
        titleFontSize: 16,
        titleColor: '#FFFFFF',
        titleFontFamily: 'SourceHanSansSC',
        titleFontWeight: 400,
        titleLineHeight: 22,
        showIndicator: true,
        indicatorSize: 17,
        indicatorColor: '#FFFFFF',
        indicatorOpacity: 0.6,
        value: '0.70',
        valueFontSize: 24,
        valueColor: '#1AD7FF',
        valueFontFamily: 'DINAlternate',
        valueFontWeight: 700,
        valueLineHeight: 30,
        valueLetterSpacing: 0.86,
        valueBackground: 'linear-gradient(90deg, #FFFFFF 0%, #81C6FF 100%)',
        showValueBackground: true,
        valueBackgroundWidth: 80,
        valueBackgroundHeight: 30,
        valueBackgroundGradientStart: 'rgba(52,165,255,0)',
        valueBackgroundGradientEnd: 'rgba(0,139,255,0)',
        valueBackgroundOpacity: 0.65,
        layout: 'horizontal',
        spacing: 16
      }
    }
  }
];

export default {
  ...FirePredictionMeta,
  snippets
};
